#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import socket
import time

client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
ip_port = ("127.0.0.1", 2002)

while True:
    inp = input(">>>>: ").strip()
    client.sendto("{}".format(inp).encode("utf-8"), ip_port)

    data, addr = client.recvfrom(1024)
    gap_time = float(data.decode("utf-8")) - time.time()
    print("客户端与服务端相关: {}".format(gap_time))
